﻿using System.Text;

namespace JsiCommon.javaScriptInterop
{
    public class JsiLiteral : IJsiExpression
    {
        private string _content;

        public JsiLiteral(string content)
        {
            _content = content;
        }

        public void Compile(StringBuilder builder)
        {
            if (_content == null)
                builder.Append("null");
            else
                builder.Append('"').Append(_content.Replace("\"", "\\\"")).Append('"');
        }
    }
}